package com.ljkj.common.application;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringApplicationContext implements ApplicationContextAware {
	
	private static ApplicationContext appContext;
	
	//私有构造方法
	private SpringApplicationContext(){
		
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		// TODO Auto-generated method stub
		appContext = applicationContext;
	}
	
	public static Object getBean(String beanName){
		return appContext.getBean(beanName);
	}
}
